Script for checking MCMC/HMC diagnostics - this might be better as an Rmd to just have one output for supplemental publication

Plethodon jordani

View Traceplots

Check Domain Specific Expectations

Check N for Truncation

The augmentation to marginalize N out as a latent discrete requires setting an upper bound, K, to loop through. If K is too small the posterior will be truncated. Need to check for every N.

## null device 
##           1

Check detection

In simulations abundance esimates are unreliable when detection gets below 20%

Check Divergences and Pairwise Correlations

Check Energy and Treedepth

Summarize Samples Sizes and Mixing

Effective samples sizes using rstan::monitor following Hoffman and Gelman (2014) to be more reliable and accurate (as in Monnahan et al. 2017) - UPDATE - now follow Vehtari et al. 2019.

effective sample sizes (should be > 100) - Aki Vehtari, Andrew Gelman, Daniel Simpson, Bob Carpenter, and Paul-Christian Bürkner (2019). Rank-normalization, folding, and localization: An improved R-hat for assessing convergence of MCMC. arXiv preprint arXiv:1903.08008.

## [1] 1.003609
## [1] 1675
## [1] 2564

Posterior Predictive Checks

Examine posterior prredictions of total counts across all 5 visits

RMSE of posterior predictive

## [1] 5.070722

Posterior predictive check for each visit

RMSE of posterior predictive for observations per visit

## [1] 2.956443

RMSE of posterior predictive

## [1] 1.322162

Desmognathus wrighti

View Traceplots

Check Domain Specific Expectations

Check N for Truncation

The augmentation to marginalize N out as a latent discrete requires setting an upper bound, K, to loop through. If K is too small the posterior will be truncated. Need to check for every N.

## null device 
##           1

Check detection

In simulations abundance esimates are unreliable when detection gets below 20%

Check Divergences and Pairwise Correlations

Check Energy and Treedepth

Summarize Samples Sizes and Mixing

Effective samples sizes using rstan::monitor following Hoffman and Gelman (2014) to be more reliable and accurate (as in Monnahan et al. 2017) - UPDATE - now follow Vehtari et al. 2019.

effective sample sizes (should be > 100) - Aki Vehtari, Andrew Gelman, Daniel Simpson, Bob Carpenter, and Paul-Christian Bürkner (2019). Rank-normalization, folding, and localization: An improved R-hat for assessing convergence of MCMC. arXiv preprint arXiv:1903.08008.

## [1] 1.00399
## [1] 2346
## [1] 2987

Posterior Predictive Checks

Examine posterior prredictions of total counts across all 5 visits

RMSE of posterior predictive

## [1] 1.315241

Posterior predictive check for each visit

RMSE of posterior predictive for observations per visit

## [1] 0.7504749

RMSE of posterior predictive

## [1] 0.3356226

Eurycea wilderae

View Traceplots

Check Domain Specific Expectations

Check N for Truncation

The augmentation to marginalize N out as a latent discrete requires setting an upper bound, K, to loop through. If K is too small the posterior will be truncated. Need to check for every N.

## null device 
##           1

Check detection

In simulations abundance esimates are unreliable when detection gets below 20%

Check Divergences and Pairwise Correlations

Check Energy and Treedepth

Summarize Samples Sizes and Mixing

Effective samples sizes using rstan::monitor following Hoffman and Gelman (2014) to be more reliable and accurate (as in Monnahan et al. 2017) - UPDATE - now follow Vehtari et al. 2019.

effective sample sizes (should be > 100) - Aki Vehtari, Andrew Gelman, Daniel Simpson, Bob Carpenter, and Paul-Christian Bürkner (2019). Rank-normalization, folding, and localization: An improved R-hat for assessing convergence of MCMC. arXiv preprint arXiv:1903.08008.

## [1] 1.003496
## [1] 2495
## [1] 3415

Posterior Predictive Checks

Examine posterior prredictions of total counts across all 5 visits

RMSE of posterior predictive

## [1] 1.404227

Posterior predictive check for each visit

RMSE of posterior predictive for observations per visit

## [1] 0.8349771

RMSE of posterior predictive

## [1] 0.3734131